import { Component, Injectable, Input } from '@angular/core';

@Component({
  selector: 'app-maskiframe',
  templateUrl: './maskIframe.component.html',
  styles: [`
    .iframewrap{width:1856px;height:420px;display:block;position:absolute;z-index:15;top:0;left:0;}
  `]
})

@Injectable({ providedIn: 'root' })

export class MaskIframeComponent {
  @Input() iframewidth: any;
  @Input() iframeheight: any;
  maskiframe = true;

  constructor() {
    window.onscroll = () => {
      this.maskTrue();
    }
    window.onclick = (e: any) => {
      const res = e.target.className;
      if (JSON.stringify(res).indexOf('iframewrap') === -1) {
        this.maskTrue();
      } else {
        this.maskFalse();
      }
    }
  }

  maskiframeClick() {
    this.maskFalse();
  }

  maskTrue() {
    this.maskiframe = true;
  }
  maskFalse() {
    this.maskiframe = false;
  }
}
